﻿using System;
using System.Collections.Generic;
using System.Text;
using FunctionalCLR;
using FunctionalCLR.Core;

namespace FunctionalCLR.Shell.Function.IO {

    /// <summary>
    /// question = listen();
    /// response = if(question == "how are you?", "fine, thank you!", "hi");
    /// echo(response);
    /// </summary>
    public class ListenNode : FuncNode {

        public ListenNode()
            : base() {
            base.Value = "listen";
        }

        public override FuncNode GetReversedFunction(int index) {
            throw new NotImplementedException();
        }

        public override object Evaluate() {
            string line = System.Console.ReadLine();

            if (string.IsNullOrEmpty(line)) {
                throw new ArgumentNullException("Please enter a statement.");
            }

            this.Value = line;
            return this.Value;
        }
    }
}
